package com.alibaba.csp.sentinel.demo.spring.web;

import com.alibaba.csp.sentinel.context.Context;
import com.alibaba.csp.sentinel.node.DefaultNode;
import com.alibaba.csp.sentinel.slotchain.ProcessorSlotEntryCallback;
import com.alibaba.csp.sentinel.slotchain.ProcessorSlotExitCallback;
import com.alibaba.csp.sentinel.slotchain.ResourceWrapper;
import com.alibaba.csp.sentinel.slots.block.BlockException;

public class DemoCallBack implements ProcessorSlotExitCallback,ProcessorSlotEntryCallback<DefaultNode> {

	@Override
	public void onExit(Context context, ResourceWrapper resourceWrapper, int count, Object... args) {
		
		System.out.println("resourceWrapper:"+resourceWrapper.getName()+" is exit");
		
	}

	@Override
	public void onPass(Context context, ResourceWrapper resourceWrapper, DefaultNode param, int count, Object... args)
			throws Exception {
		System.out.println("resourceWrapper:"+resourceWrapper.getName()+" is passed");

		
	}

	@Override
	public void onBlocked(BlockException ex, Context context, ResourceWrapper resourceWrapper, DefaultNode param,
			int count, Object... args) {
		System.out.println("resourceWrapper:"+resourceWrapper.getName()+" is blocked");

		
	}

	 

}
